package cn.qihua.model;

import java.util.ArrayList;
import java.util.List;

/**
 * SysRole entity. @author MyEclipse Persistence Tools
 */

public class SysRole implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 6068589005479126332L;
	private Integer id;
	private String text;
	private String description;
	private String resourceIds;
	private Boolean available;

	// Constructors

	/** default constructor */
	public SysRole() {
	}

	/** full constructor */
	public SysRole(String text, String description, String resourceIds,
			Boolean available) {
		this.text = text;
		this.description = description;
		this.resourceIds = resourceIds;
		this.available = available;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getResourceIds() {
		return this.resourceIds;
	}

	public void setResourceIds(String resourceIds) {
		this.resourceIds = resourceIds;
	}

	public Boolean getAvailable() {
		return this.available;
	}

	public void setAvailable(Boolean available) {
		this.available = available;
	}

	public List<Integer> getListResourceIds() {
		if (resourceIds.isEmpty() || resourceIds.equals("")) {
			return null;
		}
		String[] resourceIdStrs = resourceIds.split(",");
		List<Integer> listId = new ArrayList<Integer>();
		for (String idStr : resourceIdStrs) {
			if (idStr.isEmpty() || idStr.equals("")) {
				continue;
			}
			listId.add(Integer.valueOf(idStr));
		}
		return listId;
	}

}